<%@page import="com.mrd.constant.SystemConstants" %>
<%@page import="com.mrd.gtimp.base.pojo.User" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>问题列表</title>
    <link rel="stylesheet" type="text/css" href="../css/jquery/jquery-ui-1.8.23.custom.css" media="screen"/>
    <link rel="stylesheet" type="text/css" href="../css/jqgrid/ui.jqgrid.css" media="screen"/>
    <style type="text/css">
        ul {
            clear: both;
            padding: 0;
        }

        ul li {
            float: left;
            list-style: none;
            padding: 0;
        }

        .answer_date {
            float: right;
            color: #999
        }
    </style>
    <s:head/>
</head>
<script type="text/javascript">
    function initForm() {
        //初始化表单验证引擎
        $("#ansForm").validationEngine("attach", {
            //消息位置
            promptPosition: "bottomRight",
            scroll: false
        });
        //初始化ajaxForm参数
        var options = {
            //提交方式
            type: "POST",
            //提交数据格式
            dataType: "json",
            //在提交之前做的操作
            beforeSubmit: function () {
                return $("#ansForm").validationEngine("validate");
            },
            //成功后做的操作
            success: function (responseText, statusText, xhr, $form) {
                alert(responseText.msg);
                location.reload(true);
            }
        };
        $('#ansForm').ajaxForm(options);
    }

    function submitTheForm() {
        $("#ansForm").submit();
    }
</script>
<% User user = (User) session.getAttribute(SystemConstants.CURRENT_USER); %>
<body>
<center style="width:600px;">
    <div style="text-align: left;background-color: blue;height:50px;"><s:property value="ques.contents"/>?</div>
    <ul style="width:100%">
        <s:iterator value="ques.answers">

            <li style="width:100%">
                <div style="text-align: left;"><s:property value="contents"/></div>
                <span class="answer_date">回复时间：<s:date name="atime" format="yyyy-MM-dd hh:mm"/></span>
            </li>

        </s:iterator>
    </ul>
    <ul>
        <li>
            <form action="ans-save" id="ansForm" method="post">
                <div class="ui-widget">
                    <table class="ui-widget-content">
                        <tr>
                            <td class="td_right">回答：</td>
                            <td colspan="3">
                                <textarea class="validate[required]" rows="3" cols="40" name="ans.contents"></textarea>*
                        </tr>
                        <tr>
                            <td colspan="4" align="center" class="bts">
                                <input type="hidden" value='<s:property value="ques.id"/>' name="ques.id"/>
                                <input type="button" onclick="submitTheForm()" name="btn" value="保存"/>
                                <input type="button" onclick="close();" name="btn" value="取消"/>
                            </td>
                        </tr>
                    </table>
                </div>
            </form>
        </li>
    </ul>
</center>
</body>
</html>
